from time import sleep
import datetime
from celery import shared_task
# import django_celery_results
# import django_celery_beat
# import gevent
# import greenlet


@shared_task
def add(x, y):
    print('add 5s')
    sleep(5)
    return x + y


@shared_task
def mul(x, y):
    print('mul 2s')
    sleep(2)
    return x * y


@shared_task
def xsum(numbers):
    return sum(numbers)


@shared_task
def write_time_log():
    print('write start!!')
    now_str = datetime.datetime.now().strftime('%Y/%m/%d %H:%M:%S')
    with open('tt.txt', 'a', encoding='utf-8') as wf:
        wf.write(now_str+'\n')
        wf.write(now_str+'222222\n')
    # return sum(numbers)


# TODO period task
